using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication11.Models.Mapping
{
    public class bp_level_paraMap : EntityTypeConfiguration<bp_level_para>
    {
        public bp_level_paraMap()
        {
            // Primary Key
            this.HasKey(t => t.bp_level_id);

            // Properties
            this.Property(t => t.bp_level_name)
                .HasMaxLength(50);

            this.Property(t => t.danger_factor)
                .HasMaxLength(80);

            this.Property(t => t.bp_level_desc)
                .HasMaxLength(80);

            this.Property(t => t.bp_level_name_en_US)
                .HasMaxLength(50);

            this.Property(t => t.danger_factor_en_US)
                .HasMaxLength(100);

            this.Property(t => t.bp_level_short_en)
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("bp_level_para");
            this.Property(t => t.bp_level_id).HasColumnName("bp_level_id");
            this.Property(t => t.bp_level_name).HasColumnName("bp_level_name");
            this.Property(t => t.danger_factor).HasColumnName("danger_factor");
            this.Property(t => t.bp_level_desc).HasColumnName("bp_level_desc");
            this.Property(t => t.bp_group_id).HasColumnName("bp_group_id");
            this.Property(t => t.bp_class_id).HasColumnName("bp_class_id");
            this.Property(t => t.bp_level_name_en_US).HasColumnName("bp_level_name!en-US");
            this.Property(t => t.danger_factor_en_US).HasColumnName("danger_factor!en-US");
            this.Property(t => t.bp_level_short_en).HasColumnName("bp_level_short_en");

            // Relationships
            this.HasOptional(t => t.bp_class_para)
                .WithMany(t => t.bp_level_para)
                .HasForeignKey(d => d.bp_class_id);
            this.HasOptional(t => t.bp_group_para)
                .WithMany(t => t.bp_level_para)
                .HasForeignKey(d => d.bp_group_id);

        }
    }
}
